import { success, fail } from '../common/ResResult'
import redisConf, { RedisClient } from '../conf/Redisconfig'
import { Context } from 'koa'
import { get, post } from '../decorator/reqmethoddecorator'
import userService from '../modules/userinfo/service/userinfoService'
import { Controller } from '../decorator/controllerdecorator'

@Controller('/usermodule')
class UserController {
  @post('/login')
  async login(ctx: Context) {
    const { username,psw } = ctx.request.body;
    const userinfo = await userService.login(username,psw);
    if(userinfo){
      ctx.body = success(userinfo);
    } else {
      ctx.body = fail(userinfo);
    }
  }
}
